package com.project.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MVCConfig implements WebMvcConfigurer {
    /**
     * 配置静态访问资源；addResoureHandler：指的是对外暴露的访问路径，addResourceLocations：指的是内部文件放置的目录
     * 意思是url读取到/face/** 时，就会自动解析成D:/java/bootProject1/studentProject/src/main/resources/face/
     * 注意在face后面要加”/“
     * @param registry
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/productImg/**")
                .addResourceLocations("file:D:/java/stockSalesManange/stockSales/src/main/resources/productImg/");
    }
}
